

<div class="container">

	<div class="form-signin form-upload">
		<?php echo form_open_multipart('site/do_upload');?>

			<?php  if($this->session->flashdata('message')=='upload_success'):?>	
								<div class="alert alert-info alert-vis" role="info" style="text-align: center;">
								  <span class="glyphicon glyphicon glyphicon-ok" aria-hidden="true"></span>
								  <span class="sr-only">Info:</span>
								  Dokument je uspjesno unesen!
								</div>
			<?php  elseif($this->session->flashdata('message')=='upload_error'):?>	
								<div class="alert alert-danger alert-vis" role="alert" style="text-align: center;">
								  <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
								  <span class="sr-only">Error:</span>
								  Fajl nije odabran!
								</div>					
			<?php endif; ?>					
			<!--
			<span class="btn btn-primary btn-lg btn-block btn-file">
				Odaberi dokument <input type="file" id="upload-file" name="userfile" />
			</span> -->

			<div class="alert alert-info alert-upload" role="info" style="text-align: center; ">
					<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
					<span class="sr-only">Info:</span>								  
			</div>
			
			<div class="fileUpload btn btn-primary">
			    <span>Odaberite dokument</span>
			    <input id="uploadBtn" name="userfile" type="file" class="upload" />
			</div>

			<div class="select-menu"> 
				<div>
					<select id="select1" name='doc_type' class="bootstrap-select btn-group dropdown-menu">
						<option value="none" selected="selected">Odaberite tip dokumenta</option>
						<?php foreach ($doc_types_query as $dq){
					    echo "<option  value=" . $dq->short_name . ">" . $dq->full_name . "</option>";
					    }
					    ?>
					</select>
				</div>

				<div>
					<select id="select2" name="partner" class="bootstrap-select btn-group dropdown-menu" >
						<option value="none" selected="selected">Odaberite partnera</option>
						<?php foreach ($partners_query as $pq){
					    echo "<option  value=" . $pq->partner_short_name . ">" . $pq->partner_full_name . "</option>";
					    }
					    ?>
					</select>
				</div>
			</div>

			
			<div class='input-group date' id='datetimepicker1'>
				
				<input id="date1" type='date' name='created_on' class="form-control" required />
				<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
				</span>
			</div>

			 
			<div class="comment">
			<textarea id="text-comment" name="comment" required rows="4" class="form-control" style="resize: none" placeholder="Unesite komentar"></textarea>
			</div>

			<div class="button-upload">
				<button class="btn btn-lg btn-success btn-block btn-submit" id="submit-file" type="submit">Unesite dokument</button>
			</div>

		</form>
	</div>


</div>



<script type="text/javascript">
	$(document).ready(function() {
		$("html").click(function() {
			$(".alert-vis").hide();
		});

		$(".alert-upload").hide();

		$("#uploadBtn").change(function() {

			if($("#uploadBtn").val()!=="")
			{
			$(".alert-upload").show();
			$(".alert-upload").text($("#uploadBtn").val().split('\\').pop());
		}
		});	

		$("#submit-file").click(function() {
			if ($("#select1").val()=="none"){
				$("#select1").focus();
				return false;
			}
			if ($("#select2").val()=="none"){
				$("#select2").focus();
				return false;
			}
		});

		$("#select1").click(function(event) {
			$(this).css({
				background: 'white'
			});
		});

		$("#select2").click(function(event) {
			$(this).css({
				background: 'white'
			});
		});

	});
		
</script>




</body>
</html>